import { createStore } from 'vuex'
import {ajax} from "@/api"
export default createStore({
  state: {
    userInfo:null,  //v-if
    isCollapse:false, //菜单 false展开 true收起
    userList:[]
  },
  mutations: {
    changeUserInfomu(state,payload){
      state.userInfo = payload
    },
    changeisCollapse(state,payload){
      state.isCollapse = payload
    },
    changeUserListmu(state,payload){
      state.userList = payload
    }

  },
  actions: {
    async changeUserInfoac({commit}){
      let {code,result} = await ajax.getuserinfo()
      commit("changeUserInfomu",result)
    },
    async changeUserList({commit},payload){
      let {code,result} = await ajax.getuserList()
      commit("changeUserListmu",result)
    },
  },
  modules: {
  }
})
